home *** CD-ROM | disk | FTP | other *** search
/ Aminet 21 / Aminet 21 (1997)(GTI - Schatztruhe)[!][Oct 1997].iso / Aminet / util / libs / DigNet.lha / dignet / developer / includes / sasc / libraries / dignet.h
Encoding:
C/C++ Source or Header  |  1997-07-15  |  4.6 KB  |  169 lines

  1. #ifndef DIGNET_H
  2. #define DIGNET_H
  3.  
  4. /*
  5. **    dignet.library include
  6. **
  7. **    Copyright © 1997 by Kenneth "Kenny" Nilsen/Digital Surface
  8. **
  9. **    $VER: DIGNET_H 1.3 (14.7.97)
  10. **
  11. */
  12.  
  13. /*      C include by Stellan Klebom (melazy@kuai.se) */
  14.  
  15.  
  16. #ifndef    EXEC_TYPES_H
  17. #  include <exec/types.h>
  18. #endif
  19.  
  20.  
  21. /*
  22.  *  Error codes
  23.  */
  24.  
  25. #define    DNETERROR_OK        0    /* everything is ok */
  26. #define    DNETERROR_OVERFLOW    -1    /* buffer overflow (your string buffer) */
  27. #define    DNETERROR_WRONGNET    -2    /* you tried to free wrong net structure */
  28. #define DNETERROR_TIMEOUT    -3    /* timed out waiting to receivce chars */
  29. #define DNETERROR_POINTERERROR    -4    /* wrong pointer (null ptr.) */
  30. #define DNETERROR_OUTOFMEMORY    -5    /* not enough memory (Send/ReceiveNet()) */
  31. #define DNETERROR_FILEERROR    -6    /* file not found (Send/ReceiveNet()) */
  32. #define DNETERROR_PROTOCOL    -7    /* protocol error (not a protocol?) */
  33.  
  34. /*
  35.  *  IOEXT
  36.  */
  37.  
  38. #define DNIOEXT_SIZEOF        80    /* max size for IOEXT structure */
  39.  
  40. /*
  41.  *  InitModem buffer size
  42.  */
  43.  
  44. #define INITMODEMBUFFER        16    /* minimum length of initmodem's buffer */
  45.  
  46. /*
  47.  *  The public resource list structure
  48.  */
  49.  
  50.    typedef struct {
  51.     ULONG    DNRT_ID;        /* net ID */
  52.     APTR    DNRT_NET;        /* ptr. to netstructure */
  53.     APTR    DNRT_TASK;        /* ptr. to task structure using the net */
  54.     STRPTR    DNRT_TASKNAME;        /* ptr. to task name of that task */
  55.     STRPTR    DNRT_DEVICENAME;    /* ptr. to device name in use */
  56.     UWORD    DNRT_UNIT;        /* unit number in use */
  57.     APTR    DNRT_SP;        /* Return address */
  58.     APTR    DNRT_MESSAGEPORT;    /* ptr. to message port of device */
  59.     APTR    DNRT_MESSAGESTRUCT;    /* ptr. to IO message of device */
  60.     ULONG    DNRT_LASTCOMMAND;    /* command number on last librarycall */
  61.     WORD    DNRT_TASKSTATUS;    /* BOOL on the tasks existance (true=ok) */
  62.     ULONG    DNRT_reserved0;        /* reserved for future extensions */
  63.     ULONG    DNRT_reserved1;
  64.     ULONG    DNRT_reserved2;
  65.     ULONG    DNRT_reserved3;
  66.     ULONG    DNRT_reserved4;
  67.     } DIGNETRT;
  68.  
  69. /*
  70.  *  Command numbers:
  71.  */
  72.  
  73. #define    CMDALLOCNET        1
  74. #define    CMDREADNET        2
  75. #define    CMDWRITENET        3
  76. #define    CMDQUERYNET        4
  77. #define    CMDABORTNET        5
  78. #define    CMDINITIOEXT        6
  79. #define    CMDREADIOEXT        7
  80. #define    CMDSENDNET        8
  81. #define    CMDRECEIVENET        9
  82. #define    CMDTIMEOUT        10
  83. #define    CMDREADSTRING        11
  84. #define    CMDWRITESTRING        12
  85. #define    CMDGETNETPORT        13
  86. #define    CMDINITMODEM        14
  87. #define    CMDCALLMODEMDT        15
  88. #define    CMDCALLMODEMDP        16
  89. #define    CMDWAITMODEM        17
  90. #define    CMDHANGUPMODEM        18
  91. #define    CMDSTOPWAITING        19
  92. #define    CMDFLUSHNET        20
  93. #define    CMDSETBAUD        21
  94. #define    CMDCONVERTMODEMSTRING    22
  95. #define    CMDGETIOMSG        23
  96. #define    CMDGETMODEMSTATUS    24
  97. #define    CMDGETCURRENTDEVICE    25
  98. #define    CMDGETCURRENTUNIT    26
  99. #define    CMDGETBAUDRATE        27
  100. #define    CMDPARSECONNECT        28
  101. #define    CMDSETDEFAULT        29
  102. #define    CMDCONVERTTOPC        30
  103. #define    CMDCONVERTTOAMIGA    31
  104. #define    CMDFREECONVERT        32
  105. #define    CMDOBTAINNET        33
  106. /* new from v4 */
  107. #define    CMDWAITTEXT        34
  108. #define    CMDCONVERSETEXT        35
  109. #define    CMDCAPTURETEXTSTART    36
  110. #define    CMDCAPTURETEXTEND    37
  111. #define    CMDSETPARITY        38
  112. #define    CMDSETHANDSHAKE        39
  113. #define    CMDSETSTOPBITS        40
  114. #define    CMDSETBITWIDTH        41
  115. #define    CMDGETPARITY        42
  116. #define    CMDGETHANDSHAKE        43
  117. #define    CMDGETSTOPBITS        44
  118. #define    CMDGETBITWIDTH        45
  119.  
  120.     typedef struct {
  121.  
  122.     CHAR    DNU_FILENAME[108];        /* name of file without path */
  123.     ULONG    DNU_FILESIZE;            /* size of file in bytes */
  124.     ULONG    DNU_RATE;            /* transfer rate bytes/s */
  125.     STRUCT    DNU_EXPECTED,ds_SIZEOF;        /* expected time on transfer */
  126.     STRUCT    DNU_USED,ds_SIZEOF;        /* time used on transfer */
  127.     UWORD    DNU_STATUS;            /* status flags */
  128.     LONG    DNU_HOOK;            /* hook to be called after each */
  129.                         /* block transfer */
  130.     } DNUPDATE;
  131.  
  132. #define    DNUSTATUS_OK        $0        /* everything is ok */
  133. #define    DNUSTATUS_ERROR        $1        /* transfer had an error */
  134. #define    DNUSTATUS_RESENDING    $2        /* resending block/file */
  135. #define    DNUSTATUS_WAITING    $4        /* waiting to receive/send file */
  136. #define    DNUSTATUS_ABORT        $8        /* was aborted */
  137.                         /* (if you set this flag the */
  138.                         /* protocol will be aborted) */
  139. #define    DNUSTATUS_END        $10        /* end of file (done) */
  140.  
  141. /*
  142. To let user abort a protocol transfer you need to create a subtask that will
  143. check for user input such as keypress/mousebutton/gadget etc. If user want to
  144. abort transfer you must set the _abort flag. The other end of the protocol
  145. will read  this as user abort and end. If not this flag can be interacted the
  146. protocol will not stop until the whole file is transfered/resent error free.
  147. */
  148.  
  149. /* CaptureTextStart modes: */
  150.  
  151. #define    DNCAPTURENEW        0
  152. #define    DNCAPTUREAPPEND        -1
  153.  
  154. /* Modes for SetParity */
  155.  
  156. #define    DNPARITYNONE        0
  157. #define    DNPARITYEVEN        1
  158. #define    DNPARITYODD        2
  159. #define    DNPARITYMARK        3
  160. #define    DNPARITYSPACE        4
  161.  
  162. /* Modes for SetHandshake */
  163.  
  164. #define    DNHANDSHAKENONE        0
  165. #define    DNHANDSHAKE7WIRE    1        /* RTS/CTS  */
  166. #define    DNHANDSHAKEX        2        /* XON/XOFF */
  167.  
  168. #endif /* DIGNET_H */
  169.